libxl: generalise libxl__domain_userdata_lock()
authorPaul Durrant <pdurrant@amazon.com>
Fri, 31 Jan 2020 15:01:45 +0000 (15:01 +0000)
committerWei Liu <wl@xen.org>
Fri, 31 Jan 2020 16:10:46 +0000 (16:10 +0000)
commit1d224ce698266a6c920fdc46879e9b2a12de8e71
treec988f3a3e34cc820f93957ae3bc88d18a1fe2dc1
parent75259239d85d6e522c164f1f00ace89bb2dbb3e6
libxl: generalise libxl__domain_userdata_lock()

This function implements a file-based lock with a file name generated
from a domid.

This patch splits it into two, generalising the core of the locking code
into a new libxl__lock_file() function which operates on a specified file,
leaving just the file name generation in libxl__domain_userdata_lock().

This patch also generalises libxl__unlock_domain_userdata() to
libxl__unlock_file() and modifies all call-sites.

Suggested-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl_create.c
tools/libxl/libxl_device.c
tools/libxl/libxl_disk.c
tools/libxl/libxl_dom.c
tools/libxl/libxl_domain.c
tools/libxl/libxl_internal.c
tools/libxl/libxl_internal.h
tools/libxl/libxl_mem.c
tools/libxl/libxl_pci.c
tools/libxl/libxl_usb.c